package qsh.laputa.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.baomidou.mybatisplus.extension.toolkit.SqlHelper;
import qsh.laputa.dao.MyMapper;

/**
 * <p>
 * 服务基础类
 * </p>
 *
 * @author Qsh
 * @since 2021/3/17
 */
public interface MyService<T> extends IService<T> {

    /**
     * 逻辑删除带自动填充功能
     *
     * @param entity
     * @return
     */
    default boolean removeByIdWithFill(T entity) {
        int count = ((MyMapper<T>) getBaseMapper()).deleteByIdWithFill(entity);

        return SqlHelper.retBool(count);
    }

}
